package com.analyst.utils;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * ClassName: VirtualJobHelper
 * Package: com.analyst.utils
 * Description:
 *
 * @Author wk
 * @Create 2023/08/30 0030 下午 04:10:46
 * @Version 1.0
 */
public class VirtualJobHelper {
    public static String[] divideVirtualJobName(String system, String job) {
        String regex = "(\\w-?\\w+_\\d{6})_(\\w+)";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(job);
        if (matcher.find()) {
            return new String[]{matcher.group(1), matcher.group(2)};
        } else {
            return new String[]{system, job};
        }
    }

    public static void main(String[] args) {
        String[] strings = divideVirtualJobName("", "F-SPCR-110110_M03_SPP-P_SCP-STHPAMBK-S_030");
        System.out.println(Arrays.toString(strings));
    }
}
